package com.ag.hmk.service.impl;

import com.ag.bean.TbCasekw;
import com.ag.common.IDUtil;
/**
 * @author 黄木看
 * 经典案例服务接口实现
 */
import com.ag.hmk.dao.HmkCasekwDAO;
import com.ag.hmk.service.CasekwService;

public class CasekwServImpl implements CasekwService {
	
	private HmkCasekwDAO hmkCasekwDAO;
	
	/*
	 * 删除一条记录（by id）
	 */
	public void delete(String ckwID) {
		if (ckwID!=null) {
			TbCasekw tbCasekw = findByID(ckwID);
			if (tbCasekw!=null) {
				tbCasekw.setA(IDUtil.DELETE);
				hmkCasekwDAO.attachDirty(tbCasekw);
			}
		}
	}

	/*
	 * 查询一条记录（by id）
	 */
	public TbCasekw findByID(String ckwID) {
		if (ckwID!=null) {
			return hmkCasekwDAO.findById(ckwID);
		} else {
			return null;
		}
		
	}

	/*
	 * 新增或更新记录
	 */
	public void save(TbCasekw tbCasekw) {
		if (tbCasekw!=null) {
			tbCasekw.setA(IDUtil.PRESERVE);
			hmkCasekwDAO.attachDirty(tbCasekw);
		}
		
	}

	public void setHmkCasekwDAO(HmkCasekwDAO hmkCasekwDAO) {
		this.hmkCasekwDAO = hmkCasekwDAO;
	}

}
